using System.ComponentModel.DataAnnotations;
using MediatR;
using RBAC.ErrorCode;

namespace RBAC.Write.Api.Application.Command.ERP.MaterialFile
{
    /// <summary>
    /// 添加物料分类命令
    /// </summary>
    public class AddMaterTypeCommand : IRequest<APIResult<long>>
    {
        /// <summary>
        /// 分类编码
        /// </summary>
        [Required(ErrorMessage = "分类编码不能为空")]
        [MaxLength(50, ErrorMessage = "分类编码长度不能超过50个字符")]
        public string TypeCode { get; set; } = string.Empty;

        /// <summary>
        /// 分类名称
        /// </summary>
        [Required(ErrorMessage = "分类名称不能为空")]
        [MaxLength(100, ErrorMessage = "分类名称长度不能超过100个字符")]
        public string TypeName { get; set; } = string.Empty;

        /// <summary>
        /// 计量单位
        /// </summary>
        [MaxLength(20, ErrorMessage = "计量单位长度不能超过20个字符")]
        public string? Unit { get; set; }

        /// <summary>
        /// 分类状态：1-正常，0-禁用
        /// </summary>
        [Range(0, 1, ErrorMessage = "状态只能是0(禁用)或1(正常)")]
        public int Status { get; set; } = 1;

        /// <summary>
        /// 流水号长度
        /// </summary>
        [Range(1, 10, ErrorMessage = "流水号长度必须在1-10之间")]
        public int? Lenght { get; set; } = 4;

        /// <summary>
        /// 供应方式：采购、加工、委外、装配、生产、无
        /// </summary>
        [MaxLength(20, ErrorMessage = "供应方式长度不能超过20个字符")]
        public string? SupplyMode { get; set; } = "采购";

        /// <summary>
        /// 父分类ID，顶级分类为null
        /// </summary>
        public long? ParentId { get; set; }
    }
}